/*The MIT License

Copyright (c) <2008> <Samir Menon>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.*/

#ifndef CNANEURON_H_
#define CNANEURON_H_

#include "neurontools.h"
#include "neuron.h"

namespace bis_neuron
{
	using namespace std;
	#define DEFAULT_Na_SIGMA 1
	#define DEFAULT_Na_N 1
	#define THRESHOLD_R 0.67
	#define SUBTHRESHOLD_R 0.5
	#define SUPERTHRESHOLD_R 0.8	
	
	class CNaNeuron : public bis_neuron::CNeuron
	{
	protected:
		//Inherited: 
//		int neuron_id;
//		float vm, v_na;
//		float vm_max,vm_min;
//		float r;
//		
//		int execution_flag;
//		bool log_data_flag, log_spike_flag;
//		CSpikeSpooler *data_spooler, *spike_spooler;
//		
//		stringstream data_log_stream;
//		CSystemClock* clock;		
		
		float sigma,n;
		
	public:
		CNaNeuron();
		CNaNeuron(float arg_sigma, float arg_n);
		virtual ~CNaNeuron();	
		//Implemented virtual functions:
		void initialize(int neuron_id, CSpikeSpooler * arg_spike_spool=NULL, CSpikeSpooler * arg_data_spool = NULL);	 
		bool fire();
		bool update_vm();		
		void reset_neuron()
		{	vm = 0.0; v_na = 0.0;	}
		void set_data(const float & arg_r, const float & arg_sigma, 
												 const float & arg_n)
		{	r = arg_r; sigma = arg_sigma; n = arg_n;	}
		
//		Inherited:
//		Logging functions
//		void set_data_logging(CSpikeSpooler* arg_data_spool);
//		void log_data(); //Basic: vm,neuron_id - Each neuron class should extend this		
//		inline void set_data_log_flag_on() { log_data_flag=true;}
//		inline void set_data_log_flag_off() { log_data_flag=false;}
//		inline bool get_data_log_flag() { return log_data_flag;}
//		
//		void set_spike_logging(CSpikeSpooler* arg_spike_spool);
//		void log_spike();		
//		inline void set_spike_log_flag_on() { log_spike_flag=true;}
//		inline void set_spike_log_flag_off() { log_spike_flag=false;}
//		inline bool get_spike_log_flag() { return log_spike_flag;}
//				
//		//Wrappers
//		inline void set_exec_flag_on() { execution_flag=1;}
//		inline void set_exec_flag_off() { execution_flag=0;}
//		inline int get_exec_flag() { return execution_flag;}	
	};

}

#endif /*CNANEURON_H_*/
